Programming With QuickTime VR 2.1

Previous | Overview | Contents | Next

Managing Memory

The QuickTime VR Manager provides functions that you can use to help manage the memory used by QuickTime VR.

QTVRGetAvailableResolutions

You can use the QTVRGetAvailableResolutions function to get the image resolutions present in the current node.

OSErr QTVRGetAvailableResolutions (
                     QTVRInstance qtvr,
                     UInt16*resolutionsMask);
qtvr
An instance of a QuickTime VR movie.
resolutionsMask
On entry, a pointer to an unsigned short integer. On exit, that integer is set to a bitmask that encodes the image resolutions available at the current node.
function result
A result code.

DESCRIPTION

The QTVRGetAvailableResolutions function returns, in the unsigned short integer pointed to by the resolutionsMask parameter, a bitmask that encodes the image resolutions available at the current node of the QuickTime VR movie specified by the qtvr parameter.

A single node can contain multiple resolutions of a panorama or an object. The lowest order bit is always set and corresponds to the base resolution of the node. Each succeeding bit corresponds to a resolution that is half that (both horizontally and vertically) of the preceding bit. If an image with a resolution is present in the current node, the corresponding bit is set.

QTVRGetBackBufferMemInfo

QuickTime VR maintains an internal back buffer for caching panoramic images. You can use the QTVRGetBackBufferMemInfo function to get information about the size of the back buffer that would be required for caching a panoramic image of a specified pixel format. See "Pixel Formats" for more information.

OSErr QTVRGetBackBufferMemInfo (
                     QTVRInstance qtvr,
                     UInt16resolution,
                     UInt32 cachePixelFormat,
                     SInt32*minCacheBytes,
                     SInt32*suggestedCacheBytes,
                     SInt32*fullCacheBytes);
qtvr
An instance of a QuickTime VR movie.
resolution
The index, in the resolution bitmask returned by QTVRGetAvailableResolutions , of the desired image resolution.
cachePixelFormat
The desired pixel format for the back buffer. This value should be one of the defined pixel formats . See "Pixel Formats" for more information.
minCacheBytes
On entry, a pointer to a long integer. On exit, that long integer is set to the minimum size, in bytes, of the back buffer required to display the specified panorama with a severely limited maximum field of view. Set this parameter to nil to prevent this information from being returned.
suggestedCacheBytes
On entry, a pointer to a long integer. On exit, that long integer is set to the minimum size, in bytes, of the back buffer required to display the specified panorama with full wide-angle zooming. Set this parameter to nil to prevent this information from being returned.
fullCacheBytes
On entry, a pointer to a long integer. On exit, that long integer is set to the minimum size, in bytes, of the back buffer required to have the entire panorama in memory at once. That is the default size of the panorama back buffer. Set this parameter to nil to prevent this information from being returned.
function result
A result code.

DESCRIPTION

The QTVRGetBackBufferMemInfo function returns information about the size of the back buffer that would be required to hold some or all of the panoramic image associated with the movie specified by the qtvr parameter. This is a "what-if" function: you specify a resolution and a pixel format, and QTVRGetBackBufferMemInfo returns several buffer sizes. You can use this information, in conjunction with the QTVRSetBackBufferPrefs function, to exercise some control over the size of the back buffer.

The resolution at which an image is to be displayed is specified by the resolution parameter, which is an index into the resolution bitmask returned by the QTVRGetAvailableResolutions function. Relative to that resolution and the pixel depth determined by the cachePixelFormat parameter, the QTVRGetBackBufferMemInfo function returns, through the minCacheBytes parameter, the minimum size of the buffer needed to display the movie. Using a buffer of that size, however, may result in a severely limited maximum field of view. You can call the QTVRGetViewingLimits function to determine the actual maximum field of view.

To allow full wide-angle zooming, you should use a buffer whose size is specified by either the suggestedCacheBytes parameter or the fullCacheBytes parameter.

SPECIAL CONSIDERATIONS

QTVRGetBackBufferMemInfo is valid only for panoramic nodes.

QTVRGetBackBufferSettings

You can use the QTVRGetBackBufferSettings function to get information about the resolution, depth, and size of the back buffer maintained internally by QuickTime VR for caching a panoramic image in a particular pixel format.

OSErr QTVRGetBackBufferSettings (
                     QTVRInstance qtvr,
                     UInt16 *resolution,
                     UInt32 *cachePixelFormat,
                     SInt16 *cacheSize);
qtvr
An instance of a QuickTime VR movie.
resolution
On entry, a pointer to an unsigned short integer. On exit, that integer is set to the index of the current image resolution. See "Resolutions" for a description of the available resolutions.
cachePixelFormat
On entry, a pointer to a long integer. On exit, that long integer is set to the pixel format of the current panorama back buffer. See "Pixel Formats" for more information.
cacheSize
On entry, a pointer to a short integer. On exit, that integer is set to a value that describes the size of the current panorama back buffer. See "Cache Sizes" .
function result
A result code.

DESCRIPTION

The QTVRGetBackBufferSettings function returns, through the resolution parameter, the index of the current resolution for the QuickTime VR movie specified by the qtvr parameter. The index indicates which bit in the mask value returned by QTVRGetAvailableResolutions specifies the current resolution. For example, if the returned index is 1, the base resolution is being used. If the returned index is 2, then a resolution of half the base resolution is being used.

QTVRGetBackBufferSettings also returns the pixel format and the cache size in the cachePixelFormat and cacheSize parameters, respectively.

SPECIAL CONSIDERATIONS

QTVRGetBackBufferSettings is valid only for panoramic nodes.

SEE ALSO

Use QTVRSetBackBufferPrefs (next) to set the resolution, cache depth, and cache size of the panorama back buffer maintained internally by QuickTime VR for caching an image. Use QTVRGetAvailableResolutions (described in the section "QTVRGetAvailableResolutions" ) to determine which resolutions are supported by a node. Use QTVRGetBackBufferMemInfo (described in the section "QTVRGetBackBufferMemInfo" ) to determine the memory requirements for the preferred settings.

QTVRSetBackBufferPrefs

You can use the QTVRSetBackBufferPrefs function to set the resolution, pixel format, and size of the back buffer maintained internally by QuickTime VR for caching a panoramic image in a particular pixel format.

OSErr QTVRSetBackBufferPrefs (
                     QTVRInstance qtvr,
                     UInt16 resolution,
                     UInt32 cachePixelFormat,
                     SInt16 cacheSize);
qtvr
An instance of a QuickTime VR movie.
resolution
The desired image resolution.
cachePixelFormat
The desired pixel format for the back buffer. This value should be one of the defined pixel formats. See "Pixel Formats" for more information.
cacheSize
The desired size for the panorama back buffer. See "Cache Sizes" for constants you can use to specify a cache size.
function result
A result code.

DESCRIPTION

The QTVRSetBackBufferPrefs function sets the resolution, pixel format, and size of the panorama back buffer for the movie specified by the qtvr parameter to the values specified by the resolution , cachePixelFormat , and cacheSize parameters. You can specify a resolution that isn't contained in the movie file; if you do so, QuickTime VR takes the highest resolution image in the file and reduces it to fit into the specified buffer size.

If you specify an unsupported pixel format, the QTVRSetBackBufferPrefs function may return an error. See "Pixel Formats" for more information.

SPECIAL CONSIDERATIONS

QTVRSetBackBufferPrefs is valid only for panoramic nodes.

SEE ALSO

Use QTVRGetAvailableResolutions (described in the section "QTVRGetAvailableResolutions" ) to determine which resolutions are supported by a node. Use QTVRGetBackBufferMemInfo (described in the section "QTVRGetBackBufferMemInfo" ) to determine the memory requirements for the preferred settings.


© 1997 Apple Computer, Inc.

Previous | Overview | Contents | Next